package cn.amarone.wineblog.models.sys.service.impl;

import cn.amarone.wineblog.models.sys.entity.SysUser;
import cn.amarone.wineblog.models.sys.mapper.UserMapper;
import cn.amarone.wineblog.models.sys.service.IUserService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * 服务实现类
 *
 * @author amarone
 * @since 2020-09-08
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, SysUser> implements IUserService {

  /** 无效的 */
  public static final Integer INVALID = 1;
  /** 有效的 */
  public static final Integer AVAILABLE = 0;

  @Override
  public SysUser selectByNameStateControl(String userName) {
    LambdaQueryWrapper<SysUser> q = new LambdaQueryWrapper<>();
    q.eq(SysUser::getLoginName, userName).eq(SysUser::getAble,AVAILABLE);
    return baseMapper.selectOne(q);
  }
}
